package com.itheima.day1static;

public final class StaticUtil {
    private StaticUtil(){
    }
    public static double getAverage(double[] numbers){
        double max = numbers[0];
        double min = numbers[0];
        double sum = 0;
        for (int i = 0; i < numbers.length; i++) {
               if (numbers[i]>max){
                   max = numbers[i];
               } else if(numbers[i]<min){
                   min = numbers[i];
               }
               sum += numbers[i];
        }
        double average = (sum-max-min) *1.0 / (numbers.length-2);
        return  average;
    }
}
